<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h4 class="modal-title" id="ntModalLabel">{:lang("add/change_port(warehouse)")}</h4>
</div>
<div class="modal-body">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="alert alert-dismissable alert-info">
                <button type="button" class="close">×</button>
                <p></p>
            </div>
        </div>
        <form class="col-md-12 formbox">
            <table class="table table-hover ntTable">
                <tbody>
                <tr>
                    <td class="col-md-2">{:lang('country')}<span class="required"></span></td>
                    <td>
                        <select class="form-control col-md-2" name="country_id">
                            <option value="">{:lang('please_select')}</option>
                            {volist name="country" id="vo"}
                            {eq name="vo.id" value="$info.country_id|default=''"}
                            <option value="{$vo.id}" selected>{$vo.name}</option>
                            {else/}
                            <option value="{$vo.id}">{$vo.name}</option>
                            {/eq}
                            {/volist}
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>{:lang('name')}</td>
                    <td><input type="text" name="name" value="{$info.name|default=''}" class="form-control" value="">
                    </td>
                </tr>
                <tr>
                    <td>{:lang('type')}</td>
                    <td>
                        <label class="radio-inline">
                            <input type="radio" name="type" value="1" {eq name="info.type|default=''" value="1" }checked="checked" {/eq} checked> {:lang("export_warehouse")}
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="type" value="2" {eq name="info.type|default=''" value="2" }checked="checked" {/eq}> {:lang("warehouse")}
                        </label>
                    </td>
                </tr>
                </tbody>
            </table>
            <input type="hidden" id="act" name="act" value="{$str}">
            <input type="hidden" name="id" id="id" value="{$info.id|default=''}">
        </form>
    </div>

</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span>{:lang('cancel')}
    </button>
    <button type="button" id="quedin" class="btn btn-primary" style="padding-left:24px;padding-right:24px">
        <span class="glyphicon glyphicon-floppy-disk"></span>{:lang('save')}
    </button>
</div>
<script>
    //数据的提交
    $('#quedin').click(subfn)
    var addbm = true;
    function subfn() {
        if (addbm) {
            $.ajax({
                url: '/Admin/Logistics/' + $('#act').val(),
                type: 'post',
                data: $(".formbox").serialize(),
                dataType: 'json',
                success: function (res) {
                    if (res.status != 1) {
                        change_mes_type('.modal-body .alert',res.status)
                        $('.modal-body .alert').show()
                        $('.modal-body .alert p').html('*' + res.msg + '<br>')
                        //toastr.warning(res.msg)
                    } else {
                        change_mes_type('.alert',res.status)
                        addbm = false
                        //toastr.info(res.msg)
                        $('.alert').show()
                        $('.alert p').html('*' + res.msg + '<br>')
                        $('#port_editModal').modal('hide')
                    }
                }
            });
        }
    }
    //渲染所属部门的数据
    $(document).keydown(function (event) {
        if (event.keyCode == 13) {
            $('form').each(function () {
                event.preventDefault();
            });
            subfn()
        }
    });
</script>